package test;

import static org.junit.Assert.*;
import huffman.Hzip;

import java.util.Arrays;

import junit.framework.TestCase;

import org.junit.Test;

public class Opdracht15 extends TestCase {
	
	Support support = new Support();
	
	public void testCompress() {
		
		try {
			Hzip.compress("C:\\Users\\Malko\\workspaceThema23\\lt3file\\data\\TestD.dat");
		}
		catch (Exception e) {
			System.err.println("Fatal error: could not Compress.");
		}
		int[] result = support.readFile("C:\\Users\\Malko\\workspaceThema23\\lt3file\\data\\TestD.dat.huf");
		int[] comparison = support.readFile("C:\\Users\\Malko\\workspaceThema23\\lt3file\\data\\TestDEncoded.dat");
		
		
		assertTrue(Arrays.equals(comparison, result));
		
	}
	
	public void testUncompress() {
		
		try {
			Hzip.uncompress("C:\\Users\\Malko\\workspaceThema23\\lt3file\\data\\TestD.dat.huf");
		}
		catch (Exception e) {
			System.err.println("Fatal error: could not Compress.");
		}
		int[] result = support.readFile("C:\\Users\\Malko\\workspaceThema23\\lt3file\\data\\TestDDecoded.dat");
		int[] comparison = support.readFile("C:\\Users\\Malko\\workspaceThema23\\lt3file\\data\\TestD.dat");
		
		
		assertTrue(Arrays.equals(comparison, result));
		
	}

}
